<?php
class User_Form_Register extends Zend_Form
{
	/**
	 * Form for register user
	 * @author Nguyen Manh Hung
	 */
	public function init()
	{
		$this->setAction ( '' )
          ->setMethod ( 'post' );
          
        $title = $this->createElement('select','title');
        $title->setLabel('Gender:')
              ->setMultiOptions(array('1'=>'Male', '0'=>'Female'))
              ->setRequired(true)->addValidator('NotEmpty', true)
              ->setAttrib('class', 'input-text-login');
              
		$firstName = $this->createElement('text', 'first_name');
		$firstName->setLabel('First name:')
				->setRequired(true)
				->addFilter('StripTags')
				->addFilter('StringTrim')
				->setAttrib('size',50)
				->addValidator ( 'stringLength', false, array (3, 100 ) )
				->addValidator('NotEmpty')
				->setAttrib('class', 'input-text-login');
				
		$lastName = $this->createElement('text', 'last_name');
		$lastName->setLabel('Last name:')
				->setRequired(true)
				->addFilter('StripTags')
				->addFilter('StringTrim')
				->setAttrib('size',50)
				->addValidator ( 'stringLength', false, array (3, 100 ) )
				->addValidator('NotEmpty')
				->setAttrib('class', 'input-text-login');
				
		$username = $this->createElement('text', 'username');
		$username->setLabel('Username:')
				->setRequired(true)
				->addFilter('StripTags')
				->addFilter('StringTrim')
				->addFilter('StringToLower')
				->setAttrib('size',30)
				->addValidator('NotEmpty')
				->addValidator ( 'stringLength', false, array (6, 20 ) )
				->setAttrib('class', 'input-text-login');
				
		$password = $this->createElement('password', 'password');
		$password->setLabel('Password:')
				->setRequired(true)
				->addFilter('StripTags')
				->addFilter('StringTrim')
				->setAttrib('size',30)
				->addValidator ( 'stringLength', false, array (6, 20 ) )
				->addValidator('NotEmpty')
				->setAttrib('class', 'input-text-login');
			
		$email = $this->createElement('text', 'email');
		$email->setLabel('Email:')
				->setRequired(true)
				->addFilter('StripTags')
				->addFilter('StringTrim')
				->addFilter('StringToLower')
				->setAttrib('size',50)
				->addValidator('EmailAddress')
				->setAttrib('class', 'input-text-login');
				
		
		$submit = $this->createElement('submit', 'submit');
        $submit->setAttrib('id', 'submit_register');
        $submit->setLabel('Accept');
        $submit->setAttrib('class', 'button');   
        $submit->setDecorators(array( 'ViewHelper', array('HtmlTag', array('tag' => 'hb') ,array('Label', array('tag' => '')))));      
        $reset = $this->createElement('reset','reset',array ('label' => 'Reset'));          
        $reset->setDecorators(array( 'ViewHelper', array('HtmlTag', array('tag' => 'hb') ,array('Label', array('tag' => '')))));      
        $reset->setAttrib('class', 'button');   
        $cancel = $this->createElement('button','back',array ('label' => 'Cancel'));
        $cancel->setDecorators(array( 'ViewHelper', array('HtmlTag', array('tag' => 'hb') ,array('Label', array('tag' => '')))));
        $cancel->setAttrib('class', 'button');   
        $this->addElement ($title )
        	->addElement ($firstName )
        	->addElement($lastName)
           	->addElement ($email )           
           	->addElement($username)
           	->addElement($password)
           	->addElement($submit)
           	->addElement($reset)
           	->addElement($cancel);
	}
}